 package com.gmrz.uaf.protocol.v1.json;
 
 import com.google.gson.JsonDeserializationContext;
 import com.google.gson.JsonDeserializer;
 import com.google.gson.JsonElement;
 import com.google.gson.JsonParseException;
 import com.google.gson.JsonSerializationContext;
 import com.google.gson.JsonSerializer;
 import java.lang.reflect.Method;
 import java.lang.reflect.Type;
 
 public class ConstantsValueAdapter
   implements JsonSerializer, JsonDeserializer
 {
   private Method mget = null;
   private Method mfor = null;
 
   public ConstantsValueAdapter(Class c, Method mget, Method mfor) throws Exception {
     mget.setAccessible(true);
     mfor.setAccessible(true);
 
     this.mget = mget;
     this.mfor = mfor;
   }
 
   public Object deserialize(JsonElement json, Type type, JsonDeserializationContext ctxt) throws JsonParseException
   {
     try
     {
       return this.mfor.invoke(null, Integer.valueOf(json.getAsInt()));
     } catch (Exception e) {
       e.printStackTrace();
     }
 
     return null;
   }
 
   public JsonElement serialize(Object src, Type type, JsonSerializationContext ctxt)
   {
     try
     {
       Integer value = (Integer)this.mget.invoke(src);
       return ctxt.serialize(value);
     } catch (Exception e) {
       e.printStackTrace();
     }
 
     return null;
   }
 }
